package com.yaoli.niuke;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created by siemens on 6/2/2017.
 */
public class _025_Test {
    public static void main(String [] args){
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int set [] = new int[a];

        for(int i = 0 ; i < a; i ++){
            set[i] = input.nextInt();
        }
        boolean flag = true;

        Arrays.sort(set);

        Set<Integer> sets = new HashSet<Integer>();

        if(set[set.length - 1] % 2 == 1){
            for(int i = set.length - 1; i > 0; i--){
                if(set[i] != set[i - 1]){
                    System.out.println("NO");
                }
            }
        }else{
            int tmp = set[set.length - 1];
            while(tmp % 2 == 0){
                sets.add(tmp);
                tmp  = tmp / 2;
            }
            sets.add(tmp);

            for(int i = 0 ; i < set.length ; i++){
                if(!sets.contains(set[i])){
                    flag = false;
                    break;
                }
            }
        }


        if(flag == false){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
    }
}
